name: PR - Closed

on:
  pull_request:
    branches:
      - main
    types: [closed]

jobs:
  delete-s3:
    name: Delete S3 Website
    runs-on: ubuntu-latest
    if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/design' && github.actor != 'dependabot[bot]' && github.event.pull_request.user.login != 'dependabot[bot]' }}
    env:
      AWS_ACCESS_KEY_ID: ${{ secrets.DESIGN_DEPLOYER_AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.DESIGN_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - name: Delete Website Bucket
        uses: rishabhrao/s3-website-https-pr-action@v1
        with:
          bucket-prefix: "vapor-design-pulls"
